/**
 * 质控项目操作日志表管理初始化
 */
var SdsQcentityItemLog = {
    id: "SdsQcentityItemLogTable",	//表格id
    seItem: null,		//选中的条目
    table: null,
    layerIndex: -1
};

/**
 * 初始化表格的列
 */
SdsQcentityItemLog.initColumn = function () {
    return [
        {title: '病种', field: 'qcentity.btDesc', width:100, align: 'left', valign: 'middle', sortable: false},
        {title: '标准项目', field: 'qcentityItem.btDesc', width:200, align: 'left', valign: 'middle', sortable: false},
        {title: '操作类型', field: 'operType', width:50, align: 'center', valign: 'middle', sortable: false, formatter: function (value, row, index){
            var _html="";
            switch (value) {
                case 1:
                    _html="新增";
                    break;
                case 2:
                    _html="修改";
                    break;
                case 3:
                    _html="作废";
                    break;
                default:
                    break;
            }
            return _html;
            }},
        {title: '操作内容', field: 'operContent', width:200, align: 'left', valign: 'middle', sortable: false},
        {title: '操作日期', field: 'operTime', width:100, align: 'center', valign: 'middle', sortable: false},
        {title: '操作人', field: 'operUser', width:50, align: 'center', valign: 'middle', sortable: false}];
};

/**
 * 检查是否选中
 */
SdsQcentityItemLog.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length == 0){
        Sys.info("请先选中表格中的某一记录！");
        return false;
    }else{
        SdsQcentityItemLog.seItem = selected[0];
        return true;
    }
};

/**
 * 查询质控项目操作日志表列表
 */
SdsQcentityItemLog.search = function () {
    var queryData = {};
    queryData['entityId'] = $("#entityId").val();
    queryData['operType'] = $("#operType").combobox("getValue");
    SdsQcentityItemLog.table.refresh({query: queryData});
};

$(function () {
    var defaultColunms = SdsQcentityItemLog.initColumn();
    var table = new BSTable(SdsQcentityItemLog.id, Sys.backendPath + "/sds/sdsqcentityitemlog/list", defaultColunms);
    table.setPaginationType("server");
    var b_height = document.documentElement.clientHeight;
    table.setHeight(b_height-55);
    SdsQcentityItemLog.table = table.init();
});
